  


<!DOCTYPE html>
<html>
  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
    <meta charset='utf-8'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>eligrey/FileSaver.js · GitHub</title>
    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
    <link rel="logo" type="image/svg" href="http://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
    <link rel="assets" href="https://a248.e.akamai.net/assets.github.com/">
    <link rel="xhr-socket" href="/_sockets" />
    


    <meta name="msapplication-TileImage" content="/windows-tile.png" />
    <meta name="msapplication-TileColor" content="#ffffff" />
    <meta name="selected-link" value="repo_source" data-pjax-transient />
    <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" />

    
    
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />

    <meta content="authenticity_token" name="csrf-param" />
<meta content="WSFzE5u+jv0ypWCrMKL1xgu0Zb7RlWrk9yt4cdbkRi4=" name="csrf-token" />

    <link href="https://a248.e.akamai.net/assets.github.com/assets/github-a4c524f2138ecc4dd5bf9b8a6b1517bf38aa7b65.css" media="all" rel="stylesheet" type="text/css" />
    <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-d2a693e8a6a75b6cde3420333a9e70bd2a2e20a4.css" media="all" rel="stylesheet" type="text/css" />
    


      <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-5c60c478b1e0f90d149f11ed15aa52edd2996882.js" type="text/javascript"></script>
      <script src="https://a248.e.akamai.net/assets.github.com/assets/github-dca362d39ce6c15fd1d471169cd12026ca7ff8cc.js" type="text/javascript"></script>
      
      <meta http-equiv="x-pjax-version" content="4f7f9c630bd61e5b628d7029fe05b824">

        <link data-pjax-transient rel='permalink' href='/eligrey/FileSaver.js/tree/c3aec61188894cd872aeb415443c6cec730d8a80'>
    <meta property="og:title" content="FileSaver.js"/>
    <meta property="og:type" content="githubog:gitrepository"/>
    <meta property="og:url" content="https://github.com/eligrey/FileSaver.js"/>
    <meta property="og:image" content="https://secure.gravatar.com/avatar/f43206cf935c8a5d532285c0d67b20d1?s=420&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"/>
    <meta property="og:site_name" content="GitHub"/>
    <meta property="og:description" content="FileSaver.js - A saveAs() FileSaver implementation"/>
    <meta property="twitter:card" content="summary"/>
    <meta property="twitter:site" content="@GitHub">
    <meta property="twitter:title" content="eligrey/FileSaver.js"/>

    <meta name="description" content="FileSaver.js - A saveAs() FileSaver implementation" />


    <meta content="46995" name="octolytics-dimension-user_id" /><meta content="eligrey" name="octolytics-dimension-user_login" /><meta content="2051226" name="octolytics-dimension-repository_id" /><meta content="eligrey/FileSaver.js" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="2051226" name="octolytics-dimension-repository_network_root_id" /><meta content="eligrey/FileSaver.js" name="octolytics-dimension-repository_network_root_nwo" />
  <link href="https://github.com/eligrey/FileSaver.js/commits/master.atom" rel="alternate" title="Recent Commits to FileSaver.js:master" type="application/atom+xml" />

  </head>


  <body class="logged_out  windows vis-public env-production  ">
    <div id="wrapper">

      
      
      

      
      <div class="header header-logged-out">
  <div class="container clearfix">

    <a class="header-logo-wordmark" href="https://github.com/">Github</a>

    <div class="header-actions">
      <a class="button primary" href="/signup">Sign up</a>
      <a class="button" href="/login?return_to=%2Feligrey%2FFileSaver.js">Sign in</a>
    </div>

    <div class="command-bar js-command-bar  in-repository">


      <ul class="top-nav">
          <li class="explore"><a href="/explore">Explore</a></li>
        <li class="features"><a href="/features">Features</a></li>
          <li class="enterprise"><a href="http://enterprise.github.com/">Enterprise</a></li>
          <li class="blog"><a href="/blog">Blog</a></li>
      </ul>
        <form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">
  <a href="/search/advanced" class="advanced-search-icon tooltipped downwards command-bar-search" id="advanced_search" title="Advanced search"><span class="octicon octicon-gear "></span></a>

  <input type="text" data-hotkey="/ s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off"
    
      data-repo="eligrey/FileSaver.js"
      data-branch="master"
      data-sha="3f021c14c1ac434251ace61c24b552e9f1c5bd92"
  >

    <input type="hidden" name="nwo" value="eligrey/FileSaver.js" />

    <div class="select-menu js-menu-container js-select-menu search-context-select-menu">
      <span class="minibutton select-menu-button js-menu-target">
        <span class="js-select-button">This repository</span>
      </span>

      <div class="select-menu-modal-holder js-menu-content js-navigation-container">
        <div class="select-menu-modal">

          <div class="select-menu-item js-navigation-item selected">
            <span class="select-menu-item-icon octicon octicon-check"></span>
            <input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked" />
            <div class="select-menu-item-text js-select-button-text">This repository</div>
          </div> <!-- /.select-menu-item -->

          <div class="select-menu-item js-navigation-item">
            <span class="select-menu-item-icon octicon octicon-check"></span>
            <input type="radio" name="search_target" value="global" />
            <div class="select-menu-item-text js-select-button-text">All repositories</div>
          </div> <!-- /.select-menu-item -->

        </div>
      </div>
    </div>

  <span class="octicon help tooltipped downwards" title="Show command bar help">
    <span class="octicon octicon-question"></span>
  </span>


  <input type="hidden" name="ref" value="cmdform">

  <div class="divider-vertical"></div>

</form>
    </div>

  </div>
</div>


      


            <div class="site hfeed" itemscope itemtype="http://schema.org/WebPage">
      <div class="hentry">
        
        <div class="pagehead repohead instapaper_ignore readability-menu ">
          <div class="container">
            <div class="title-actions-bar">
              

<ul class="pagehead-actions">



    <li>
      <a href="/login?return_to=%2Feligrey%2FFileSaver.js"
        class="minibutton js-toggler-target star-button entice tooltipped upwards"
        title="You must be signed in to use this feature" rel="nofollow">
        <span class="octicon octicon-star"></span>Star
      </a>
      <a class="social-count js-social-count" href="/eligrey/FileSaver.js/stargazers">
        359
      </a>
    </li>
    <li>
      <a href="/login?return_to=%2Feligrey%2FFileSaver.js"
        class="minibutton js-toggler-target fork-button entice tooltipped upwards"
        title="You must be signed in to fork a repository" rel="nofollow">
        <span class="octicon octicon-git-branch"></span>Fork
      </a>
      <a href="/eligrey/FileSaver.js/network" class="social-count">
        59
      </a>
    </li>
</ul>

              <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
                <span class="repo-label"><span>public</span></span>
                <span class="mega-octicon octicon-repo"></span>
                <span class="author vcard">
                  <a href="/eligrey" class="url fn" itemprop="url" rel="author">
                  <span itemprop="title">eligrey</span>
                  </a></span> /
                <strong><a href="/eligrey/FileSaver.js" class="js-current-repository">FileSaver.js</a></strong>
              </h1>
            </div>

            
  <ul class="tabs">
    <li class="pulse-nav"><a href="/eligrey/FileSaver.js/pulse" class="js-selected-navigation-item " data-selected-links="pulse /eligrey/FileSaver.js/pulse" rel="nofollow"><span class="octicon octicon-pulse"></span></a></li>
    <li><a href="/eligrey/FileSaver.js" class="js-selected-navigation-item selected" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /eligrey/FileSaver.js">Code</a></li>
    <li><a href="/eligrey/FileSaver.js/network" class="js-selected-navigation-item " data-selected-links="repo_network /eligrey/FileSaver.js/network">Network</a></li>
    <li><a href="/eligrey/FileSaver.js/pulls" class="js-selected-navigation-item " data-selected-links="repo_pulls /eligrey/FileSaver.js/pulls">Pull Requests <span class='counter'>0</span></a></li>

      <li><a href="/eligrey/FileSaver.js/issues" class="js-selected-navigation-item " data-selected-links="repo_issues /eligrey/FileSaver.js/issues">Issues <span class='counter'>5</span></a></li>

      <li><a href="/eligrey/FileSaver.js/wiki" class="js-selected-navigation-item " data-selected-links="repo_wiki /eligrey/FileSaver.js/wiki">Wiki</a></li>


    <li><a href="/eligrey/FileSaver.js/graphs" class="js-selected-navigation-item " data-selected-links="repo_graphs repo_contributors /eligrey/FileSaver.js/graphs">Graphs</a></li>


  </ul>
  
  <div id="repo_details" class="metabox clearfix
       ">
      <div id="repo_details_loader" class="context-loader" style="display:none">Sending Request&hellip;</div>

        <div class="repo-desc-homepage">
          
    <div class="repository-lang-stats">
      <div class="repository-lang-stats-graph">
      <span class="language-color" style="width:100%; background-color:#f15501;" itemprop="keywords">JavaScript</span>
      </div>
      <ol class="list-tip">
        <li>
            <a href="/languages/JavaScript">
              <span class="color-block language-color" style="background-color:#f15501;"></span>
              <span class="lang">JavaScript</span>
              <span class="percent">100%</span>
            </a>
        </li>
      </ol>
    </div>

<div id="repository_description" class="repository-description">
    <p>A saveAs() FileSaver implementation
      <span id="read_more" style="display:none">&mdash; <a href="#readme">Read more</a></span>
    </p>
</div>


<div class="repository-homepage" id="repository_homepage">
  <p><a href="http://eligrey.com/blog/post/saving-generated-files-on-the-client-side" rel="nofollow">http://eligrey.com/blog/post/saving-generated-files-on-the-client-side</a></p>
</div>


        </div>

      <div class="edit-repo-desc-homepage" style="display:none">
        <form accept-charset="UTF-8" action="/eligrey/FileSaver.js/settings/update_meta" id="js-update-repo-meta-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="WSFzE5u+jv0ypWCrMKL1xgu0Zb7RlWrk9yt4cdbkRi4=" /></div>
          <p class="error" style="display:none">Sorry, but there was a problem saving your changes.</p>
          <input type="text" id="repository-description-field" class="description-field" name="repo_description" value="A saveAs() FileSaver implementation" placeholder="Add a description to this repository">
          <input type="text" id="repository-homepage-field" class="homepage-field" name="repo_homepage" value="http://eligrey.com/blog/post/saving-generated-files-on-the-client-side" placeholder="Add a website to this repository">

          <div class="edit-repo-actions">
            <button type="submit" class="button save-button">Save changes</button>
            <span class="cancel">
              <a href="#" class="button danger">Cancel</a>
            </span>
          </div>
</form>      </div>

      
<div class="url-box js-url-box">
  <ul class="native-clones">
      <li><a href="http://windows.github.com" class="button minibutton " icon_class="octicon-device-desktop"><span class="octicon octicon-device-desktop"></span>Clone in Windows</a></li>
      <li><a href="/eligrey/FileSaver.js/archive/master.zip" class="button minibutton " icon_class="octicon-cloud-download" rel="nofollow" title="Download this repository as a zip file"><span class="octicon octicon-cloud-download"></span>ZIP</a>
  </ul>

  <div class="clone-urls js-clone-urls clone-urls-windows">
    <span class="http_clone_url clone-url-button js-clone-url-button selected"><a href="https://github.com/eligrey/FileSaver.js.git" class="js-git-protocol-selector" data-permission="Read-Only" data-url="/users/set_protocol?protocol_selector=http&amp;protocol_type=clone">HTTP</a></span>
<span class="public_clone_url clone-url-button js-clone-url-button"><a href="git@github.com:eligrey/FileSaver.js.git" class="js-git-protocol-selector" data-permission="Read-Only" data-url="/users/set_protocol?protocol_selector=ssh&amp;protocol_type=clone">SSH</a></span>
<span class="public_clone_url clone-url-button js-clone-url-button"><a href="git://github.com/eligrey/FileSaver.js.git" class="js-git-protocol-selector" data-permission="Read-Only" data-url="/users/set_protocol?protocol_selector=gitweb&amp;protocol_type=clone">Git Read-Only</a></span>
    <span class="clone-url">
      <input type="text" readonly spellcheck="false" class="url-field js-url-field" value="https://github.com/eligrey/FileSaver.js.git" >
    </span>
    <span class="clone-url-button">
      <span class="js-zeroclipboard url-box-clippy zeroclipboard-button" data-clipboard-text="https://github.com/eligrey/FileSaver.js.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
    </span>
  </div>
  <p class="url-description"><span class="bold js-clone-url-permission">Read-Only</span> access</p>
</div>

        </div>

<div class="tabnav">

  <span class="tabnav-right">
    <ul class="tabnav-tabs">
          <li><a href="/eligrey/FileSaver.js/tags" class="js-selected-navigation-item tabnav-tab" data-selected-links="repo_tags /eligrey/FileSaver.js/tags">Tags <span class="counter blank">0</span></a></li>
    </ul>
  </span>

  <div class="tabnav-widget scope">


    <div class="select-menu js-menu-container js-select-menu js-branch-menu">
      <a class="minibutton select-menu-button js-menu-target" data-hotkey="w" data-ref="master">
        <span class="octicon octicon-branch"></span>
        <i>branch:</i>
        <span class="js-select-button">master</span>
      </a>

      <div class="select-menu-modal-holder js-menu-content js-navigation-container">

        <div class="select-menu-modal">
          <div class="select-menu-header">
            <span class="select-menu-title">Switch branches/tags</span>
            <span class="octicon octicon-remove-close js-menu-close"></span>
          </div> <!-- /.select-menu-header -->

          <div class="select-menu-filters">
            <div class="select-menu-text-filter">
              <input type="text" id="commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
            </div>
            <div class="select-menu-tabs">
              <ul>
                <li class="select-menu-tab">
                  <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
                </li>
                <li class="select-menu-tab">
                  <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
                </li>
              </ul>
            </div><!-- /.select-menu-tabs -->
          </div><!-- /.select-menu-filters -->

          <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="branches">

            <div data-filterable-for="commitish-filter-field" data-filterable-type="substring">

                <div class="select-menu-item js-navigation-item selected">
                  <span class="select-menu-item-icon octicon octicon-check"></span>
                  <a href="/eligrey/FileSaver.js/tree/master" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="master" rel="nofollow" title="master">master</a>
                </div> <!-- /.select-menu-item -->
            </div>

              <div class="select-menu-no-results">Nothing to show</div>
          </div> <!-- /.select-menu-list -->


          <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="tags">
            <div data-filterable-for="commitish-filter-field" data-filterable-type="substring">

            </div>

            <div class="select-menu-no-results">Nothing to show</div>

          </div> <!-- /.select-menu-list -->

        </div> <!-- /.select-menu-modal -->
      </div> <!-- /.select-menu-modal-holder -->
    </div> <!-- /.select-menu -->

  </div> <!-- /.scope -->

  <ul class="tabnav-tabs">
    <li><a href="/eligrey/FileSaver.js" class="selected js-selected-navigation-item tabnav-tab" data-selected-links="repo_source /eligrey/FileSaver.js">Files</a></li>
    <li><a href="/eligrey/FileSaver.js/commits/master" class="js-selected-navigation-item tabnav-tab" data-selected-links="repo_commits /eligrey/FileSaver.js/commits/master">Commits</a></li>
    <li><a href="/eligrey/FileSaver.js/branches" class="js-selected-navigation-item tabnav-tab" data-selected-links="repo_branches /eligrey/FileSaver.js/branches" rel="nofollow">Branches <span class="counter ">1</span></a></li>
  </ul>

</div>

  
  
  


            
          </div>
        </div><!-- /.repohead -->

        <div id="js-repo-pjax-container" class="container context-loader-container" data-pjax-container>
          


<!-- tree commit key: views10/v8/tree:v21:255110e89ef2ad64965e995b7a92f12b -->

  <div id="slider">
      <div class="frame-meta">
          

          <p class="history-link js-history-link-replace">
              <a href="/eligrey/FileSaver.js/commits/master">
                <span class="octicon octicon-history tooltipped" title="Browse commits for this branch"></span>
                31 commits
</a>          </p>

        <div class="breadcrumb">
          <span class='bold'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/eligrey/FileSaver.js" class="js-slide-to" data-branch="master" data-direction="back" itemscope="url"><span itemprop="title">FileSaver.js</span></a></span></span><span class="separator"> / </span><form action="/login?return_to=%2Feligrey%2FFileSaver.js" class="js-new-blob-form tooltipped rightwards new-file-link" method="post" title="Sign in to make or propose changes"><span class="js-new-blob-submit octicon octicon-file-add"></span></form>
        </div>

        <a href="/eligrey/FileSaver.js/find/master"
           class="js-slide-to" data-hotkey="t" style="display:none">Show File Finder</a>

      </div><!-- ./.frame-meta -->

      

  <div class="frames">
    <div class="frame" data-permalink-url="/eligrey/FileSaver.js/tree/c3aec61188894cd872aeb415443c6cec730d8a80" data-title="eligrey/FileSaver.js · GitHub" data-type="tree">

      <div class="bubble tree-browser-wrapper">

      <table class="tree-browser css-truncate" cellpadding="0" cellspacing="0">
        <thead>
            
  <div class="commit commit-tease js-details-container" >
    <p class="commit-title ">
        <a href="/eligrey/FileSaver.js/commit/c3aec61188894cd872aeb415443c6cec730d8a80" class="message">Update README.md</a>
        
    </p>
    <div class="commit-meta">
      <span class="js-zeroclipboard zeroclipboard-link" data-clipboard-text="c3aec61188894cd872aeb415443c6cec730d8a80" data-copied-hint="copied!" title="Copy SHA"><span class="octicon octicon-clippy"></span></span>
      <a href="/eligrey/FileSaver.js/commit/c3aec61188894cd872aeb415443c6cec730d8a80" class="sha-block" data-pjax>latest commit <span class="sha">c3aec61188</span></a>

      <div class="authorship">
        <img class="gravatar" height="20" src="https://secure.gravatar.com/avatar/f43206cf935c8a5d532285c0d67b20d1?s=140&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="20" />
        <span class="author-name"><a href="/eligrey" data-skip-pjax="true" rel="author">eligrey</a></span>
        authored <time class="js-relative-date updated" datetime="2013-05-23T13:31:58-07:00" title="2013-05-23 13:31:58">May 23, 2013</time>

      </div>
    </div>
  </div>

        </thead>

        

<tbody class="tree-entries js-deferred-content"
    data-url="/eligrey/FileSaver.js/tree-commits/master">


    <tr>
      <td class="icon"><span class="octicon octicon-file-directory"></span></td>
      <td class="content"><a href="/eligrey/FileSaver.js/tree/master/demo" class="js-directory-link js-slide-to css-truncate-target" id="fe01ce2a7fbac8fafaed7c982a04e229-ead07e303b45314b8a18c50f38c3436be9232694" title="demo">demo</a></td>
      <td class="age"><time class="js-relative-date" datetime="2013-01-23T18:43:15-08:00" title="2013-01-23 18:43:15">January 23, 2013</time></td>

      <td class="message">
          <a href="/eligrey/FileSaver.js/commit/f8b520304b9663687f88c6659db812aa01f31f84" class="message">Fixed mime type of files saved in demo</a>
          [<a href="/eligrey" rel="author">eligrey</a>]

      </td>
    </tr>
    <tr>
      <td class="icon"><span class="octicon octicon-file-text"></span></td>
      <td class="content"><a href="/eligrey/FileSaver.js/blob/master/FileSaver.js" class="js-directory-link js-slide-to css-truncate-target" id="a1994ccf4140c4d9a0fdecf2698de179-84826c5d5ccf96229eadafaf8a666434badd47e3" title="FileSaver.js">FileSaver.js</a></td>
      <td class="age"><time class="js-relative-date" datetime="2013-04-10T06:49:15-07:00" title="2013-04-10 06:49:15">April 10, 2013</time></td>

      <td class="message">
          <a href="/eligrey/FileSaver.js/commit/fff6b3fc7648ef202ecc12614a24a10565b74b84" class="message">Closes</a> <a href="https://github.com/eligrey/FileSaver.js/issues/20" class="issue-link" title="Firefox 20: file is saved twice">#20</a>
          [<a href="/eligrey" rel="author">eligrey</a>]

      </td>
    </tr>
    <tr>
      <td class="icon"><span class="octicon octicon-file-text"></span></td>
      <td class="content"><a href="/eligrey/FileSaver.js/blob/master/FileSaver.min.js" class="js-directory-link js-slide-to css-truncate-target" id="290258ac7bf24d47d0b0011ba70e063a-bb37fdb8769f3f98209f7c56ae7619573bf0143b" title="FileSaver.min.js">FileSaver.min.js</a></td>
      <td class="age"><time class="js-relative-date" datetime="2013-04-10T09:31:59-07:00" title="2013-04-10 09:31:59">April 10, 2013</time></td>

      <td class="message">
          <a href="/eligrey/FileSaver.js/commit/53b768be2e689f500941da91ece36f2ef9ee9115" class="message">Update FileSaver.min.js</a>
          [<a href="/eligrey" rel="author">eligrey</a>]

      </td>
    </tr>
    <tr>
      <td class="icon"><span class="octicon octicon-file-text"></span></td>
      <td class="content"><a href="/eligrey/FileSaver.js/blob/master/LICENSE.md" class="js-directory-link js-slide-to css-truncate-target" id="37854d19817c792316d481f5beb93cc7-7eb56b98e9f6db2129f002a25ab1a04cc8c5db4f" title="LICENSE.md">LICENSE.md</a></td>
      <td class="age"><time class="js-relative-date" datetime="2011-07-14T20:28:11-07:00" title="2011-07-14 20:28:11">July 14, 2011</time></td>

      <td class="message">
          <a href="/eligrey/FileSaver.js/commit/5b94c4440714de15643eb30fc0fe1e1c504c6141" class="message">Initial commit</a>
          [<a href="/eligrey" rel="author">eligrey</a>]

      </td>
    </tr>
    <tr>
      <td class="icon"><span class="octicon octicon-file-text"></span></td>
      <td class="content"><a href="/eligrey/FileSaver.js/blob/master/README.md" class="js-directory-link js-slide-to css-truncate-target" id="04c6e90faac2675aa89e2176d2eec7d8-92c1bc49eb6c3ddfaf2155dffabc6274731f6042" title="README.md">README.md</a></td>
      <td class="age"><time class="js-relative-date" datetime="2013-05-23T13:31:58-07:00" title="2013-05-23 13:31:58">May 23, 2013</time></td>

      <td class="message">
          <a href="/eligrey/FileSaver.js/commit/c3aec61188894cd872aeb415443c6cec730d8a80" class="message">Update README.md</a>
          [<a href="/eligrey" rel="author">eligrey</a>]

      </td>
    </tr>
</tbody>

      </table>
      </div>

        <div id="readme" class="clearfix announce instapaper_body md">
          <span class="name"><span class="octicon octicon-book"></span> README.md</span><article class="markdown-body entry-content" itemprop="mainContentOfPage"><h1>
<a name="filesaverjs" class="anchor" href="#filesaverjs"><span class="octicon octicon-link"></span></a>FileSaver.js</h1>

<p>FileSaver.js implements the W3C <code>saveAs()</code> <a href="http://www.w3.org/TR/file-writer-api/#the-filesaver-interface">FileSaver</a> interface in browsers that do
not natively support it. There is a <a href="http://eligrey.com/demos/FileSaver.js/">FileSaver.js demo</a> that demonstrates saving
various media types.</p>

<p>FileSaver.js is the solution to saving files on the client side, and is perfect for
webapps that need to generate files or for saving sensitive information that shouldn't be
sent to an external server.</p>

<h2>
<a name="supported-browsers" class="anchor" href="#supported-browsers"><span class="octicon octicon-link"></span></a>Supported Browsers</h2>

<ul>
<li>Internet Explorer 10+</li>
<li>Firefox 4+</li>
<li>Google Chrome</li>
<li>Opera 11+</li>
<li>Safari 5+</li>
</ul><p>Unlisted future versions of browsers will probably work too; I just haven't
tested them.</p>

<h2>
<a name="syntax" class="anchor" href="#syntax"><span class="octicon octicon-link"></span></a>Syntax</h2>

<pre><code>FileSaver saveAs(in Blob data, in DOMString filename)
</code></pre>

<h2>
<a name="examples" class="anchor" href="#examples"><span class="octicon octicon-link"></span></a>Examples</h2>

<h3>
<a name="saving-text" class="anchor" href="#saving-text"><span class="octicon octicon-link"></span></a>Saving text</h3>

<pre><code>var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");
</code></pre>

<p>The standard W3C File API <a href="https://developer.mozilla.org/en-US/docs/DOM/Blob"><code>Blob</code></a> interface is not available in all browsers.
<a href="https://github.com/eligrey/Blob.js">Blob.js</a> is a cross-browser <code>Blob</code> implementation that solves this.</p>

<h3>
<a name="saving-a-canvas" class="anchor" href="#saving-a-canvas"><span class="octicon octicon-link"></span></a>Saving a canvas</h3>

<pre><code>var canvas = document.getElementById("my-canvas"), ctx = canvas.getContext("2d");
// draw to canvas...
canvas.toBlob(function(blob) {
    saveAs(blob, "pretty image.png");
});
</code></pre>

<p>Note: The standard HTML5 <code>canvas.toBlob()</code> method is not available in all browsers.
<a href="https://github.com/eligrey/canvas-toBlob.js">canvas-toBlob.js</a> is a cross-browser <code>canvas.toBlob()</code> implementation that solves
this.</p>

<h3>
<a name="aborting-a-save" class="anchor" href="#aborting-a-save"><span class="octicon octicon-link"></span></a>Aborting a save</h3>

<pre><code>var filesaver = saveAs(blob, "whatever");
cancel_button.addEventListener("click", function() {
    if (filesaver.abort) {
        filesaver.abort();
    }
}, false);
</code></pre>

<p>This isn't that useful unless you're saving very large files (e.g. generated video).</p>

<p><a href="https://in.getclicky.com/212712ns.gif" target="_blank"><img src="https://in.getclicky.com/212712ns.gif" alt="Tracking image" style="max-width:100%;"></a></p></article>
        </div>
    </div>
  </div>
  <br style="clear:both;">


<br style="clear:both;">

<div id="js-frame-loading-template" class="frame frame-loading large-loading-area" style="display:none;">
  <img class="js-frame-loading-spinner" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-128.gif?1347543525" height="64" width="64">
</div>


  </div>

        </div>
      </div>
      <div class="modal-backdrop"></div>
    </div>

      <div id="footer-push"></div><!-- hack for sticky footer -->
    </div><!-- end of wrapper - hack for sticky footer -->

      <!-- footer -->
      <div id="footer">
  <div class="container clearfix">

      <dl class="footer_nav">
        <dt>GitHub</dt>
        <dd><a href="/about">About us</a></dd>
        <dd><a href="/blog">Blog</a></dd>
        <dd><a href="/contact">Contact &amp; support</a></dd>
        <dd><a href="http://enterprise.github.com/">GitHub Enterprise</a></dd>
        <dd><a href="http://status.github.com/">Site status</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>Applications</dt>
        <dd><a href="http://mac.github.com/">GitHub for Mac</a></dd>
        <dd><a href="http://windows.github.com/">GitHub for Windows</a></dd>
        <dd><a href="http://eclipse.github.com/">GitHub for Eclipse</a></dd>
        <dd><a href="http://mobile.github.com/">GitHub mobile apps</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>Services</dt>
        <dd><a href="http://get.gaug.es/">Gauges: Web analytics</a></dd>
        <dd><a href="http://speakerdeck.com">Speaker Deck: Presentations</a></dd>
        <dd><a href="https://gist.github.com">Gist: Code snippets</a></dd>
        <dd><a href="http://jobs.github.com/">Job board</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>Documentation</dt>
        <dd><a href="http://help.github.com/">GitHub Help</a></dd>
        <dd><a href="http://developer.github.com/">Developer API</a></dd>
        <dd><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></dd>
        <dd><a href="http://pages.github.com/">GitHub Pages</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>More</dt>
        <dd><a href="http://training.github.com/">Training</a></dd>
        <dd><a href="/edu">Students &amp; teachers</a></dd>
        <dd><a href="http://shop.github.com">The Shop</a></dd>
        <dd><a href="/plans">Plans &amp; pricing</a></dd>
        <dd><a href="http://octodex.github.com/">The Octodex</a></dd>
      </dl>

      <hr class="footer-divider">


    <p class="right">&copy; 2013 <span title="0.05643s from fe17.rs.github.com">GitHub</span>, Inc. All rights reserved.</p>
    <a class="left" href="/">
      <span class="mega-octicon octicon-mark-github"></span>
    </a>
    <ul id="legal">
        <li><a href="/site/terms">Terms of Service</a></li>
        <li><a href="/site/privacy">Privacy</a></li>
        <li><a href="/security">Security</a></li>
    </ul>

  </div><!-- /.container -->

</div><!-- /.#footer -->


    <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
  <div class="fullscreen-container js-fullscreen-container">
    <div class="textarea-wrap">
      <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
          <div class="suggester-container">
              <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
                 data-url="/eligrey/FileSaver.js/suggestions/commit">
              </div>
          </div>
    </div>
  </div>
  <div class="fullscreen-sidebar">
    <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
      <span class="mega-octicon octicon-screen-normal"></span>
    </a>
    <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
      title="Switch themes">
      <span class="octicon octicon-color-mode"></span>
    </a>
  </div>
</div>



    <div id="ajax-error-message" class="flash flash-error">
      <span class="octicon octicon-alert"></span>
      Something went wrong with that request. Please try again.
      <a href="#" class="octicon octicon-remove-close ajax-error-dismiss"></a>
    </div>

    
    <span id='server_response_time' data-time='0.05679' data-host='fe17'></span>
    
  </body>
</html>

